package song.NO_1;

import java.util.ArrayList;
import java.util.Collections;

public class Main {
    private final static int target = 11;
    public static void main(String[] args) {
        Integer [] array_ = {15, 2, 11, 7, 4, 4};
        ArrayList<Integer> array = new ArrayList<>();
        Collections.addAll(array, array_);
        function fun = new function();
        array.sort(fun);
        int left = 0, right = array.size()-1, result = array.get(left) + array.get(right);
        while (result != target){
            if (result > target) --right;
            else if (result < target) ++left;
            result = array.get(left) + array.get(right);
        }
        System.out.println(left + " " + right);
    }
}
